
Use NEXUS_DB

GO
--------------------------------------Insert---------------
Alter PROC insertStores
	@StoreName nvarchar(500),
	@StoreAddress nvarchar(500),
	@StorePhone nvarchar(50),
	@CityID int
AS
INSERT INTO  Stores(StoreName,StoreAddress,StorePhone,CityID) VALUES(@StoreName,@StoreAddress,@StorePhone,@CityID)

GO
---------------------------------------------------update-------------------
ALter PROC updateStores
	@StoreID int,
	@StoreName nvarchar(500),
	@StoreAddress nvarchar(500),
	@StorePhone nvarchar(50),
	@CityID int
AS
UPDATE Stores SET	
	StoreName=@StoreName,
	StoreAddress=@StoreAddress,
	StorePhone=@StorePhone,
	CityID=@CityID
WHERE StoreID=@StoreID
GO
---------------------------------------Delete--------------------

CREATE PROC deleteStores
	@StoreID int
AS
	DELETE FROM Stores WHERE StoreID=@StoreID
GO
-----------------------------getAll
ALTER PROC getAllStores
AS
SELECT     Stores.*, City.CityName
FROM         Stores INNER JOIN
                      City ON Stores.CityID = City.CityID
GO
-----------------------------getStoresByID
CREATE PROC getStoresByID
	@StoreID int
AS
SELECT * from Stores WHERE StoreID=@StoreID
GO


